/**
 * @file
 * @author  Cameron Diver
 * @version 0.1
 * @brief A library to provide widgets for use in games, or other applications using SDL
 * @section Description
 *
 * A library which provides several customisable widgets, whch can deployed with ay SDL
 * application, and cana be updated and changed at any point at runtime, not just at instantiation,
 */

#ifndef WIDGETS_HEADER
#define WIDGETS_HEADER

#include <stdbool.h>
#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>

#include "String.h"

#ifndef MAX
	#define MAX(A, B) ((A) < (B) ? (A) : (B))
#endif


typedef enum
{
	Widget_ProgressBar,
	Widget_Label
}W_WidgetType;

typedef struct
{
	int R,G,B;
}W_Colour;

typedef struct
{
	int Width, Height, X, Y;
	W_Colour Colour;
	Uint8 Weight;
	int Progress;
}W_ProgressBar;

typedef struct
{
	S_String *Text;
	int Size, X, Y;
	char *Font;
	W_Colour Colour;
	bool Changed;
	SDL_Surface *Current;
}W_Label;

typedef struct
{
	void (*RenderFunc)(SDL_Surface *, void *); /* This is the function that it called for the widgets to be rendered */
	void *Data;	/* This can be anything that the widget wants to be remembered */
}W_Widget;

int W_Init();
W_Widget *W_NewProgressBar(int X, int Y, int Width, int Height, Uint8 Weight, W_Colour Colour);
W_Widget *W_NewLabel(int X, int Y, int Size, S_String *Text, char *FontPath, W_Colour Colour);
void W_DrawToSurface(W_Widget *Widget, SDL_Surface *Screen);
/* Creates a new W_Widget that is not associated with anything */
W_Widget *W_NewW_Widget();
void W_FreeWidget(W_Widget *W);
#endif /* WIDGETS_HEADER */

